import { IParam, EntityBase } from '@/core';
import { IAuth_user } from './interface/i-auth-user';
import Auth_userKeys from './auth-user-keys';

/**
 * 认证用户基类
 * 基于template/src/api/{{appEntities}}/{{appEntities}}-base.ts.hbs生成
 *
 * @export
 * @abstract
 * @class Auth_userBase
 * @extends { EntityBase }
 * @implements { IAuth_user }
 */
export abstract class Auth_userBase extends EntityBase implements IAuth_user {
	/**
	 * 实体名称
	 *
	 * @readonly
	 * @type {string}
	 * @memberof Auth_userBase
	 */
	get srfdename(): string {
		return 'AUTH_USER';
	}

	/**
	 * 当前实体所有属性
	 *
	 * @protected
	 * @type {string[]}
	 * @memberof Auth_userBase
	 */
	protected get keys(): string[] {
		return Auth_userKeys;
	}

	/**
	 * Creates an instance of ConstactOppoBase.
	 * @param {*} [data]
	 * @memberof Auth_userBase
	 */
	constructor(data?: any) {
		super();
		this.setData(data);
	}

	get srfkey(): string {
		return this.id;
	}

	set srfkey(val: string) {
		this.id = val;
	}

	/**
	 * 标识
	 **/
	id?: any;

	get srfmajortext(): string {
		return this.display_name;
	}

	set srfmajortext(val: string) {
		this.display_name = val;
	}
	/**
	 * 名称
	 **/
	display_name?: any;

	/**
	 * username/uid
	 **/
	username?: any;

	/**
	 * DC
	 **/
	dc?: any;

	/**
	 * 组织机构标识
	 **/
	organization_id?: any;

	/**
	 * 人员编号
	 **/
	employee_number?: any;

	/**
	 * 类型
	 **/
	employee_type?: any;

	/**
	 * 职位
	 **/
	title?: any;

	/**
	 * 电子邮箱
	 **/
	mail?: any;

	/**
	 * 联系电话
	 **/
	telephone_number?: any;

	/**
	 * 移动电话
	 **/
	mobile?: any;

	/**
	 * 证件号
	 **/
	identification_number?: any;

	/**
	 * 地址
	 **/
	postal_address?: any;

	/**
	 * 描述
	 **/
	description?: any;

	/**
	 * 状态
	 **/
	status?: any;

	/**
	 * 头像
	 **/
	avatar?: any;

	/**
	 * 隶属于
	 **/
	member_of?: any;

	/**
	 * 系统授权
	 **/
	roles?: any;

	/**
	 * 重置实体数据
	 *
	 * @param {IParam} [data={}]
	 * @memberof Auth_userBase
	 */
	reset(data: IParam = {}): void {
		super.reset(data);
		this.id = data.id || data.srfkey;
		this.display_name = data.display_name || data.srfmajortext;
	}
}
